#include <REGX52.H>


void Delay1ms(unsigned int time)		//@11.0592MHz
{
	unsigned char i, j;
	while(time--)
	{
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}
}
	unsigned char move;
int main()
{
	P2=~0x01;//1111 1110

	while(1)
	{
		if(P3_1==0)
		{
			Delay1ms(20);
			while(P3_1==0);
			Delay1ms(20);
			move++;
			P2=~(0x01<<move);//0000 0001
		}
		else if(P3_0==0)
		{
			Delay1ms(20);
			while(P3_0==0);
			Delay1ms(20);
			move--;
			P2=~(0x01<<move);//0000 0001
		}
		if(move >= 8)
		{
			move=0;
		}
}

	return 0;
}
